package cn.hxzy.controller;


import cn.hxzy.common.Constant;
import cn.hxzy.pojo.Proinfo;
import cn.hxzy.pojo.User;
import cn.hxzy.service.UserService;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author songmengxin
 * @since 2021-07-31
 */
@RestController
@CrossOrigin
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/getLoginUser")
    public JSONObject getLoginUser(HttpServletRequest request){
        HttpSession session = request.getSession();
//真实数据
//        User user = (User) session.getAttribute(Constant.USER_SESSION);
//测试数据
        User user=new User();
        user.setUserId(2);
        user.setUserName("ww");
        user.setPassWord("222");
        user.setUserHead("spyd1.jpg");
        user.setName("王五");
        user.setIntroduce("我叫王五，来自河北");

        JSONObject jsonObject=new JSONObject();
        jsonObject.put("code",0);
        jsonObject.put("msg","获取数据成功");
        jsonObject.put("data",user);
        return  jsonObject;
    }


}

